package iterator.v1;

public class ArrayList_ implements Collection_ {
    Object[] data = new Object[10];
    int size = 0;

    @Override
    public void add(Object obj) {
        if (size == data.length) {
            Object[] data2 = new Object[data.length * 2];
            System.arraycopy(data, 0, data2, 0, data.length);
            data = data2;
        }
        data[size++] = obj;

    }

    @Override
    public int size() {
        return size;
    }

}
